package com.chixing.day12.day12_Homework;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.SplittableRandom;

public class ArrayListDemo {
    public static void main(String[] args){
        //1
        ArrayList list = new ArrayList();
        list.add("Jason");
        list.add("Mars");
        list.add("lyon");
        list.add("is ");
        list.add("good");
        list.add("name");
        System.out.println(list);

        //2
        System.out.println(list.size());
        //3
        Iterator<String> it = list.iterator();
        while(it.hasNext()){
            String str = it.next();
            System.out.println(str);
        }

        //4
        System.out.println(list.get(0));

        //5
        System.out.println(list.get(list.size() - 1));

        //6
        System.out.println(list.contains("hello"));

        //7
        System.out.println(list.indexOf("good"));

        //8
        System.out.println(list.remove("good"));

        //9
        System.out.println(list.remove(list.get(2)));
    }
}
